@extends('frontend::layout')

@section('title', '学生列表')

@section('content')
    <div class="card border-no">
        <div class="card-body">
            <form method="get">
                <div class="row">
                    <div class="clearfix"></div>
                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <label class="col-md-2 col-sm-12">
                            <input class="form-control" type="text" placeholder="姓名" name="child_name" value="{{ old("child_name") ?: (isset($query['child_name']) ? $query['child_name'] : '') }}" />
                        </label>
                        <label class="col-md-2 col-sm-12">
                            <button class="btn btn-primary btn-sm">搜索</button>
                        </label>
                    </div>
                </div>
            </form>
{{--            <h4 class="text-black f-20">学生统计</h4>--}}
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">{{ __('Username') }}</th>
                        <th scope="col">{{ __('Sex') }}</th>
                        <th scope="col">评测次数</th>
                        <th scope="col">基础版次数</th>
                        <th scope="col">进阶版次数</th>
                        <th scope="col">高阶版次数</th>
                        <th scope="col">{{ __('Options') }}</th>
                    </tr>
                    </thead>
                    <tbody>
                    @if(isset($list))
                        @foreach($list as $idx => $item)
                            <tr>
                                <th scope="row">{{ $idx + 1 }}</th>
                                <td>{{ $item->name }}</td>
                                <td>{{ $item->sex == 1 ? "男" : "女" }}</td>
                                <td>
                                        <a href="{{ route('wechat.analysis.assessment', ['child_id' => $item->id]) }}" class="text-error" title="评测次数">&nbsp;&nbsp;
                                            <button type="button" class="btn btn-primary">{{ $item->assessments()->count() }}</button>
                                        </a>
                                </td>
                                <td>
                                        <a href="{{ route('wechat.analysis.basecount', ['child_id' => $item->id]) }}" class="text-error" title="基础版次数">&nbsp;&nbsp;
                                            <button type="button" class="btn btn-secondary">{{ $item->histories()->where("grade_id", 1)->count() }}</button>
                                        </a>
                                </td>

                                <td>
                                        <a href="{{ route('wechat.analysis.middlecount', ['child_id' => $item->id]) }}" class="text-error" title="进阶版次数">&nbsp;&nbsp;
                                            <button type="button" class="btn btn-success">{{ $item->histories()->where("grade_id", 2)->count() }}</button>
                                        </a>
                                </td>

                                <td>
                                        <a href="{{ route('wechat.analysis.highcount', ['child_id' => $item->id]) }}" class="text-error" title="高阶版次数">&nbsp;&nbsp;
                                            <button type="button" class="btn btn-warning">{{ $item->histories()->where("grade_id", 3)->count() }}</button>
                                        </a>
                                </td>

                                <td>
                                        <a href="{{ route('wechat.analysis.childsuccess', ['child_id' => $item->id]) }}" class="text-error" title="成功失败">&nbsp;&nbsp;<i class="fa fa-bar-chart"></i></a>
                                </td>
                            </tr>
                        @endforeach
                    @endif
                    </tbody>
                </table>
            </div>
            <div class="row">
                <div class="clearfix"></div>
                <div class="col-md-12 col-sm-12 col-xs-12 pull-right">
                    @if(isset($list))
                        {{ $list->links() }}
                    @endif
                </div>
            </div>
        </div>
    </div>
@stop